1. Technical Field
The present invention relates to a method and system for debugging hybrid source code, and more particularly to debugging code containing Java and HTML source code.
2. Prior Art
The ubiquitous Internet, is essentially a network of computers connected using the TCP/IP as the transportation mechanism for communicating between the computers. The World Wide Web (WWW) allows users on one computer to access files and data on remote computers using a program called a Web browser. One feature of a browser is that it allows a user to read, in a graphical user interface (GUI), Hyper Text Markup Language (HTML) documents or, colloquially, Web pages. Essentially, when the person accessing the Internet (the user) opens a browser or another similar program to view Web pages a URL (uniform resource locator) must be specified by the user, by the browser of another software program. The URL specifies the address of the computer (server) from which the Web is being requested. The server then, directly or indirectly, delivers the requested Web pages in the form of an HTML file to the browser over the Internet, generally using the Hypertext Transfer Protocol (HTTP). The browser then translates the file for viewing by the user.
As the use of the Internet progressed it became clear that simply providing people with static pages that contained only text and images was not going to be enough. For example, businesses that were going xe2x80x9con-linexe2x80x9d needed more powerful tools that could allow the user to access their databases and to purchase goods over the Internet.
Unfortunately, not everyone uses the same computers or even the same operating systems, so a need arose for a programming language that could operate on any machine regardless of its operating system. One of the languages that have accomplished this is Sun Microsystems, Inc., Java(trademark) language, an object-oriented, network capable programming language. Java is run on a virtual machine within the operating system. The communication between the virtual machine and the Java program is te same for all operating systems, and the virtual machine communicates to the operating system it is running on. Java programs can run as stand alone applications or as applets running under a Java capable browser. To create an applet, the developer writes it in the Java language, compiles it and calls it from a HTML Web page. To create an application, you write it in the Java language, compile it and call it from the command line or from another program.
Currently, the most visible examples of Java software are xe2x80x9cappletsxe2x80x9d that are available on the Internet. These applets are sent from the server to the browser, which acts as the virtual machine to execute the applet. However, there are other kinds of Java software, including software that runs on servers, or on large mainframe computers. In these cases, Java may be used to monitor transactions, manipulate data, or to streamline the flow of information between departments, suppliers, and customers.
Further developments in this area have led to JavaServer(trademark) (JSP) technology, which is a new hybrid language. JSP technology allows Java code to be imbedded directly into a static HTML Web document. This feature makes it possible to create dynamically generated content for Web pages quickly and easily on the server. Also, the imbedded Java code is designed to act more as a scripting language than Java programming, although it may act as both, emphasizing the use of components conforming to Sun Microsystems, Inc., JavaBeans(trademark) specification.
JavaBeans is a portable, platform-independent component model written in the Java programming language. JavaBeans acts as a bridge between proprietary component models. Since these components do much of the processing work, component development the component (business rules) aspect of the Web page do not have to be as concerned with the appearance of the page, and vice versa.
Another advantage of the JSP technology is that it is compiled and executed on the server side. An important result of this is the fact that the browser doesn""t need to have any special capabilities to view a JSP file or page since it is completely processed on the server side and delivered to the browser in HTML format. Another result is that the JSP file is only compiled once. The server checks to see if the JSP file has been altered since it was last compiled. If it has then it is recompiled, but if it hasn""t then it can be run from memory reducing the average access time of the page.
From a developer""s point of view, there are however still some deficiencies with the JSP development environment. Currently, the only method a developer has of verifying the JSP code that it has been written is to load the page onto a Web server, load it through a Web browser and inspect the output. While this is inefficient, it has been improved upon the introduction of a software development tool in International Business Machines Corporation""s VisualAge(copyright) for Java software. This tool allows a Web server to run on the developer""s computer so that it is no longer necessary to load a JSP file onto a separate server.
Further, there is still a need for an efficient method for programmers to xe2x80x9cdebugxe2x80x9d this type of code. Essentially, debugging is the process by which a program developer searches for logic errors in the developed software that may cause the program to behave erroneously or to cease working altogether. Currently, the method of error checking is simply to insert statements into the code that strategically display important values or phrases on the screen. The programmer then utilizes this output to determine whether the program is operating as it should. Unfortunately, this method is neither very reliable nor very useful since it relies on the fact that the statements have been put in the correct places all the time. It is also a very tedious process and can lead to unwanted errors if the statements are not removed once the debugging is complete. Hence, there is a need for a debug system that mitigates some of the above disadvantages.
In accordance with an aspect of the invention, a method for debugging hybrid source code, said method comprising the steps of translating the hybrid source code into source code; loading the source code into a development environment and compiling the source code into executable code; and running the executable code in the development environment, providing an output from the executing code to a user interface, and allowing concurrent debugging of the source code and executable code in the development environment. The method may further comprise the step of running a server to provide the output to the browser. The method may also comprise the step of running the server within a virtual machine instance. The method also may comprise the step of running the server inside the development environment. The user interface may be a browser. Allowing debugging may comprise making a change to the executable code while the executable code is running without having to restart the executable code. Allowing debugging may also comprise debugging simultaneously in the development environment the source code and related code to the hybrid source. The hybrid source may be JavaServerPages code containing Java and HTML code.
In another aspect of the invention there is provided a method for debugging hybrid source code, said method comprising the steps of translating the hybrid source code into source code by a page compiler; overriding a load class method in the page compiler for redirecting the source code to a development environment and compiling the source code into executable code; and running the executable code in the development environment, providing an output from the executing code to a user interface, and allowing concurrent debugging of the source code and executable code in the development environment. The method may further comprise of running a server to provide the output to the browser. The method may further comprise running the server within a virtual machine instance. The method may also comprise running the server inside the development environment.
There is also provided a program storage device readable by a data processing system, tangibly embodying a program of instructions, executable by said data processing system to perform the above method steps.
In accordance with another aspect of the invention there is provided a computer program product for debugging hybrid source code, said computer program product comprising: means for translating the hybrid source code; means for loading the source code into a development environment and compiling the source code into executable code; and means for running the executable code in the development environment, providing an output from the executing code to a user interface, and allowing concurrent debugging of the source code and executable code in the development environment.
There is also provided a computer system for debugging hybrid source code comprising a page compiler for translating the hybrid source into source code, providing the source code to a development environment; and a development environment for compiling the source code into executable code, providing an output from the executing code to a user interface, and allowing concurrent debugging of the source code and executable code in the development environment. The method may further comprise a server to provide the output to the browser. The server may run within a virtual machine instance. The server may also run in the development environment. The user interface may be a browser. The development environment may also allow for making a change to the executable code while the executable code is running without having to restart the executable code. The development environment may also allow for debugging simultaneously in the development environment the source code and related code to the hybrid source code. The hybrid source code may be JavaServerPages code containing Java and HTML code.